export class MainMenuScene extends Phaser.Scene {
    constructor() {
        super({ key: 'MainMenuScene' });
    }

    create() {
        // 添加背景
        this.add.rectangle(0, 0, this.game.config.width, this.game.config.height, 0x000000)
            .setOrigin(0);

        // 添加标题
        const title = this.add.text(this.game.config.width / 2, 100, '杀戮尖塔', {
            fontSize: '64px',
            fill: '#ffffff',
            fontFamily: 'Arial'
        }).setOrigin(0.5);

        // 添加开始游戏按钮
        const startButton = this.add.text(this.game.config.width / 2, 250, '开始游戏', {
            fontSize: '32px',
            fill: '#ffffff',
            fontFamily: 'Arial'
        })
        .setOrigin(0.5)
        .setInteractive();

        // 添加测试场景按钮
        const testButton = this.add.text(this.game.config.width / 2, 350, '测试场景', {
            fontSize: '32px',
            fill: '#ffffff',
            fontFamily: 'Arial'
        })
        .setOrigin(0.5)
        .setInteractive();

        // 添加按钮悬停效果
        startButton.on('pointerover', () => {
            startButton.setStyle({ fill: '#ff0' });
        });

        startButton.on('pointerout', () => {
            startButton.setStyle({ fill: '#ffffff' });
        });

        testButton.on('pointerover', () => {
            testButton.setStyle({ fill: '#ff0' });
        });

        testButton.on('pointerout', () => {
            testButton.setStyle({ fill: '#ffffff' });
        });

        // 添加点击事件
        startButton.on('pointerdown', () => {
            this.scene.start('GameScene');
        });

        testButton.on('pointerdown', () => {
            this.scene.start('TestScene');
        });
    }
}